<!DOCTYPE html>
<html lang="en">
{% include 'head.html' %}
<body>
	{% include 'navbar.html' %}
	{% include 'header.html' %}
	
	{% if movies or unranked_movies or unseen_movies %}
		<table class="table table-striped">
			{% if movies %}
				<tr>
					<th class="span1">Rank</th>
					<th class="span6">Movie</th>
				</tr>
				{% for movie in movies %}
					<tr>
						<td>{{forloop.counter}}</td>
						{% url movies.views.view_movie urltitle=movie.UrlTitle as movie_url %}
						<td><a href="{{movie_url}}">{{movie.Title}} ({{movie.Year}})</a></td>
					</tr>
				{% endfor %}
			{% endif %}
			{% if unranked_movies %}
				<tr>
					<th colspan="2">Unranked ({{unranked_movies|length}} titles)</th>
				</tr>
				{% for movie in unranked_movies %}
					<tr>
						{% url movies.views.view_movie urltitle=movie.UrlTitle as movie_url %}
						<td colspan="2"><a href="{{movie_url}}">{{movie.Title}} ({{movie.Year}})</a></td>
					</tr>
				{% endfor %}
			{% endif %}
			{% if unseen_movies %}
				<tr>
					<th colspan="2">Want To See ({{unseen_movies|length}} titles)</th>
				</tr>
				{% for movie in unseen_movies %}
					<tr>
						{% url movies.views.view_movie urltitle=movie.UrlTitle as movie_url %}
						<td colspan="2"><a href="{{movie_url}}">{{movie.Title}} ({{movie.Year}})</a></td>
					</tr>
				{% endfor %}
			{% endif %}
		</table>
	
		{% if profile.id == request.session.auth_profile_id %}
			<div class="row">
				<div class="span1">
					<a class="btn btn-large btn-success" href="{{profile_url}}?rank=1">Rank</a>
				</div>
			</div>
		{% endif %}
	{% else %}
		{% if profile.id == request.session.auth_profile_id %}
			{% url movies.views.discovery as discovery_url %}
			<big>No movies ranked. You should <a href="{{discovery_url}}">Find Movies</a> to populate this page.</big>
		{% else %}
			<big>No movies ranked.</big>
		{% endif %}
	{% endif %}
	
	{% include 'footer.html' %}
</body>
</html>